function def_before_draw_game(G)
% def_before_draw_game: Default subroutine before drawing game stuff in each game step
%
% SYNTAX:
%   def_before_draw_game(G)
%   This routine just changes title of main simulation window via G.title.
%   Will be called before real drawing game stuff in each simulation step.
%   You can provide your own routine following the calling syntax here.

%   Author: Hongbin Ma
%   Last updated: 2009-6-1 with MATLAB 6.5
%   Problems or suggestions? Email me: mathmhb[at]163.com

if ~isempty(G.title),
    if class(G.title)=='char',
        tit=G.title;
    elseif class(G.title)=='function_handle',
        tit=feval(G.title,G);
    end;
else,
    if G.h==1,
        tit=sprintf('step=%d',G.step);
    else,
        tit=sprintf('time=%g, step=%d',G.t,G.step);
    end;
end;
title(tit);
